#define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int printsum(int n)
{
	int sum = 0;
	while (n > 9)
	{
		return printsum(n / 10) + n % 10;
	}
	return n % 10;
}

int main()
{
	int n = 0;
	scanf("%d", &n);
	int ret = printsum(n);
	printf("%d", ret);
	return 0;
}